

#pragma once

#include "zdbmain.h"

#pragma pack (push, 8)

class UcDbBreakPointRef;

class UcDbBreakData : public UcDbObject
{
public:
    UCDB_DECLARE_MEMBERS(UcDbBreakData);

    UcDbBreakData();
    virtual ~UcDbBreakData();

    UcDbObjectId dimObjId() const;
    Ucad::ErrorStatus setDimObjId(const UcDbObjectId& dimId);

    Ucad::ErrorStatus addBreakPointRef(UcDbBreakPointRef* ptRef);
    Ucad::ErrorStatus getBreakPointRef(int lineIndex,
                              UcArray<UcDbBreakPointRef*>& ptRefs) const;
    Ucad::ErrorStatus getBreakPointRef(UcArray<UcDbBreakPointRef*>& ptRefs) const;
    Ucad::ErrorStatus deleteAllBreakPointRefs();
    Ucad::ErrorStatus removeAssociativity(bool force = true);
    Ucad::ErrorStatus postToDb(UcDbObjectId& breakObjId);
    Ucad::ErrorStatus eraseFromDb(void);
    virtual Ucad::ErrorStatus dwgInFields (UcDbDwgFiler*);
    virtual Ucad::ErrorStatus dwgOutFields(UcDbDwgFiler*) const;

    virtual Ucad::ErrorStatus dxfInFields (UcDbDxfFiler*);
    virtual Ucad::ErrorStatus dxfOutFields(UcDbDxfFiler*) const;

    virtual void  modifiedGraphics(const UcDbEntity* pEnt);
    Ucad::ErrorStatus updateAssociativity(const UcDbObjectIdArray& ids, int cmdType);
};

class UcDbBreakPointRef : public UcDbObject
{
public:
    UCDB_DECLARE_MEMBERS(UcDbBreakPointRef);

    enum BreakPointType {
        kDynamic           = 0,
        kStatic            = 1,
        kStatic2Point      = 2
    };

    UcDbBreakPointRef();
    virtual ~UcDbBreakPointRef();

    UcDbBreakPointRef::BreakPointType pointType() const;
    Ucad::ErrorStatus setPointType(UcDbBreakPointRef::BreakPointType newVal);
    ZSoft::Int32 lineIndex() const;
    Ucad::ErrorStatus setLineIndex(ZSoft::Int32 index);
    UcGePoint3d breakPoint() const;
    Ucad::ErrorStatus setBreakPoint(const UcGePoint3d& pt);
    UcGePoint3d breakPoint2() const;
    Ucad::ErrorStatus setBreakPoint2(const UcGePoint3d& pt);
    Ucad::ErrorStatus getBreakPointId(UcDbFullSubentPath& idPath) const;
    Ucad::ErrorStatus setBreakPointId(const UcDbFullSubentPath& idPath);
    UcDbEntity *subentPtr() const;
    Ucad::ErrorStatus intersectWith(const UcDbEntity* pEnt,
                                    UcGePoint3dArray& points,
                                    UcGePoint3dArray& textBoxPts);
    virtual Ucad::ErrorStatus dwgInFields (UcDbDwgFiler*);
    virtual Ucad::ErrorStatus dwgOutFields(UcDbDwgFiler*) const;

    virtual Ucad::ErrorStatus dxfInFields (UcDbDxfFiler*);
    virtual Ucad::ErrorStatus dxfOutFields(UcDbDxfFiler*) const;
};

Ucad::ErrorStatus ucdbGetBreakSubentIndex(UcDbEntity* pEnt,
                                     const UcGePoint3d& pickPt,
                                     const UcGeVector3d& viewDir,
                                     int& subentIndex,
                                     UcGePoint3d& ptOnEnt,
                                     const UcGeTol& tol = UcGeContext::gTol);

#pragma pack (pop)

